<?php require_once('../../core/import.php');?>
<?php User::Permission('STATISTICS_ACCOUNT'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <script type="text/javascript" src="../../scripts/import.js"></script>
    <script type="text/javascript" src="../../scripts/components/checkbox/import.checkbox.js"></script>
    <script type="text/javascript" src="../../scripts/components/zebra_table/import.zebra_table.js"></script>
    <SCRIPT src="scripts/setday.js"></SCRIPT> 
<!--    <script type="text/javascript" src="scripts/list.js"></script>-->
</head>

<body>
	<?php
	  #获取数据
	  $Tables=Functions::HttpArgs('id');//表名
	  $Period_Class=Functions::HttpArgs('Period_Class');//days
	  $Period=Functions::HttpArgs('Period');//日期
	  $Cxecution=Functions::HttpArgs('Cxecution');//版块
	  $UserName=Functions::HttpArgs('UserName');//管理员
	  if(!$UserName){ $UserName=User::Session('Username');}
	  $TdField_Third='';
	  $Colspan=3;
	  if($Cxecution=='网商助手--新增信息') $Colspan=4;
	  //exit($Cxecution);
	?>
    <table width="98.5%" id="List" border="0" cellpadding="0" cellspacing="0" class="List">
    <thead>
    <tr><td colspan="<?php echo $Colspan?>"> &nbsp;<?php User::Sum_Count($Cxecution,'Cxecution',$Period_Class,$Period,$UserName); ?> </td></tr>
    </thead>
    <thead>
    <?php
    	switch($Cxecution)
		{
			case '其它--网商助手':
				$TdFirst='问题';
				$TdSecond='类别';
				$TdThird='发布时间';
				$TdField_First='Question';
				$TdField_Second='ClassID';
				$TdField_Third='/admin/modules/faq/edit.php';
				break;
			case '其它--合作伙伴':
				$TdFirst='标题';
				$TdSecond='网址';
				$TdThird='';
				$TdField_First='Name';
				$TdField_Second='URL';
				$TdField_Third='/admin/modules/partner/list.php';
				break;
			case '其它--友情链接':
				$TdFirst='标题';
				$TdSecond='网址';
				$TdThird='';
				$TdField_First='Name';
				$TdField_Second='URL';
				$TdField_Third='/admin/modules/link/list.php';
				break;
			default:
				exit('参数错误');
		}
	?>
    <tr>
     	<th width="30%" height="25" align="center" valign="middle"><?php echo $TdFirst ?></th>
        <th width="30%" align="center" valign="middle"><?php echo $TdSecond ?></th>
        <?php if($TdThird){ ?>
        <th width="15%" align="center" valign="middle"><?php echo $TdThird ?></th>
        <?php } ?>
        <th width="15%" align="center" valign="middle"></th>
    </tr>
    <?php
	  switch($Period_Class)
		{
			case 'days':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年%m%月%d%日\') days from statistics';
				break;
			case 'weeks':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年%u%周\') weeks from statistics';
				break;
			case 'months':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年%m%月\') months from statistics';
				break;
			case 'years':
				$Selects='select *,DATE_FORMAT(Datetime,\'%Y%年\') years from statistics';
				break;
			default:
				exit('参数错误');
		}
	  
	  $Wheres=' where UserName=\''.$UserName.'\' and Cxecution=\''.$Cxecution.'\'';
	  $Sqls=$Selects.$Wheres;
	  $Datas=DB::GetRows($Sqls);
	  $Messages='';
	  foreach($Datas as $Rows)
		{
			if($Period==$Rows[$Period_Class]) $Messages=$Messages.$Rows['MessageID'].',';
		}
	  $Messages=rtrim($Messages, ",");
  	  $Data=DB::GetData('select * from '.$Tables.' where ID in ('.$Messages.') order by ID desc limit ?,15');
    ?>
    
      
    </thead>    
    <tbody>
    <form id="Form1" name="Form1" method="post" >
    <?php
	if(count($Data['Record'])>0)
	{
     foreach($Data['Record'] as $Row)
	  {
	?>
    <tr>
        <td height="25" align="center" valign="middle">
        <?php echo $Row[$TdField_First]?>
        </td>
        <td height="25" align="center" valign="middle">&nbsp;
        <?php
			if($TdField_Second=='ClassID')
			{
				echo DB::GetValueByID('faq_class',$Row[$TdField_Second],'Name');
				
			}else
			{
				echo $Row[$TdField_Second];
			}
		?>
        </td>
        <?php if($TdThird){ ?>
            <td height="25" align="center" valign="middle">&nbsp;
            <?php echo $Row['Datetime']?>
       		</td>
        <?php } ?>
        <td height="25" align="left" valign="middle">&nbsp;
        <?php if($TdThird){ 
			   	  echo '<a href="'.$TdField_Third.'?id='.$Row['ID'].'">编辑</a>';
			  }else{
				  echo '<a href="'.$TdField_Third.'">编辑</a>';
			  }
		?>
        </td>
    </tr>
    <?php
        }
	}
	else
	{
		echo '<tr><td align=center colspan=4>该信息已被删除。</td></tr>';
	}
    ?>
    </form>
    </tbody>    
    <tfoot>
    <tr>
        <td height="25" colspan="<?php echo $Colspan?>" align="center" valign="middle">
            <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td width="55%" align="left">
                <?php
                    PagerFactory::Create('Simple')->Display($Data,array
					 (
			  	 	'Parameters'=>array(
					'id'=>$Tables,
					'Period_Class'=>$Period_Class,
					'Period'=>$Period,
					'Cxecution'=>$Cxecution,
					'UserName'=>$UserName
					 )
					 ));
                ?>
                </td>
            </tr>
            </table>    
         </td>
	</tr>
    </tfoot>    
    </table>
</body>
</html>